//
//  GlodLibraryController.m
//  WuJieLive
//
//  Created by 张瀚坤 on 2017/11/2.
//  Copyright © 2017年 zhk. All rights reserved.
//

#import "GlodLibraryController.h"
#import "CheckDetailController.h"
#import "GoldScoreController.h"
#import "MyGoldController.h"
#import "IceScoreController.h"

@interface GlodLibraryController ()
@property (weak, nonatomic) IBOutlet UIView *headerView;
@property (weak, nonatomic) IBOutlet UIButton *detailBtn;  // 查看明细
@property (weak, nonatomic) IBOutlet UIButton *scoreBtn;  // 积分具体Btn
@property (weak, nonatomic) IBOutlet UIButton *iceScoreBtn;  // 冻结积分
@property (weak, nonatomic) IBOutlet UIButton *myScoreBtn; // 我的积分Btn
@property (weak, nonatomic) IBOutlet UIButton *goldBtn; // 金币具体Btn
@property (weak, nonatomic) IBOutlet UIButton *myGoldBtn;  // 我的金币Btn
@property (weak, nonatomic) IBOutlet UIButton *incomeBtn;  // 今日收益Btn
@property (weak, nonatomic) IBOutlet UILabel *moneyLabel;
@property (weak, nonatomic) IBOutlet UILabel *iceScoreLabel;

@end

@implementation GlodLibraryController


- (IBAction)goBack:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

-(void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBar.hidden = YES;
}

-(void)setUI
{
    self.myScoreBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
    self.myGoldBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
    self.scoreBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 95 , 0, 0);
    self.goldBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 95 , 0, 0);
    
    [self.detailBtn.layer setMasksToBounds:YES];
    [self.detailBtn.layer setCornerRadius:15];
    self.detailBtn.backgroundColor = ColorWithHexString(@"ffffff");
    self.detailBtn.alpha = 0.2;
    self.view.backgroundColor = Color(245, 245, 245);
    self.headerView.backgroundColor = [UIColor colorWithPatternImage:Image(@"box_小金库")];
    
    self.incomeBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 10);
}

- (void)setData
{
    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    NSDictionary * dict = @{@"token":self.userToken};
    [HTTPTool POSTForm:[NSString stringWithFormat:@"%@deposit-account/my-treasury",BaseUrl] para:dict success:^(BOOL isSuccess, id responseObject) {
        [MBProgressHUD hideHUDForView:self.view animated:YES];
        if (isSuccess) {
            self.moneyLabel.text = [responseObject objectForKey:@"data"][@"gold_money_format"];
            [self.scoreBtn setTitle:[responseObject objectForKey:@"data"][@"frozen_integration_format"] forState:(UIControlStateNormal)];
            self.iceScoreLabel.text = [NSString stringWithFormat:@"冻结积分:%@",[responseObject objectForKey:@"data"][@"frozen_integration_format"]];
            [self.goldBtn setTitle:[NSString stringWithFormat:@"%@",[responseObject objectForKey:@"data"][@"integration_gold_account_format"]] forState:(UIControlStateNormal)];
            [self.incomeBtn setTitle:[NSString stringWithFormat:@"今日收益:%@",[responseObject objectForKey:@"data"][@"today_gold_format"]] forState:(UIControlStateNormal)];
        }
    } failure:^(NSError *error) {
        [MBProgressHUD hideHUDForView:self.view animated:YES];
    }];
}

- (IBAction)checkDetailAction:(id)sender {
    
    CheckDetailController * vc = [[CheckDetailController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
    
}

#pragma mark 我的积分按钮
- (IBAction)myScoreAction:(id)sender {
    GoldScoreController * vc = [[GoldScoreController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark 我的金币按钮
- (IBAction)myGoldBtn:(id)sender {
    MyGoldController * vc = [[MyGoldController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}
- (IBAction)iceScoreAction:(id)sender {
    IceScoreController * vc = [[IceScoreController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
